FUNCTION

add_auth_handler

function add_auth_handler(scope: text, flags: list<text>, message: (gtv) -> text?, resolver: (gtv, byte_array, list<byte_array>) -> byte_array??): map<text, _auth_handler>

Utility function that allows easily adding an auth handler. It should be used by dapps, while library developers should generally prefer using add_overridable_auth_handler instead, allowing dapps to override the default handler.

Throws if scope is not valid

Example:

operation my_op() { ... }

@extend(auth.auth_handler)
function () = auth.add_auth_handler(
    rell.meta(my_op).mount_name,
    flags,
    message_function,
    resolver_function
);

Parameters

  • scope — The scope of the auth handler - either an operation name or a mount point
  • flags — The flags parameter of the auth handler
  • message — The message parameter of the auth handler
  • resolver — The resolver parameter of the auth handler

See Also

© 2024 Chromia